package com.efast.cafe.portal.dao.statemach;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.efast.cafe.commponent.statemach.bean.StateMachByRoleBean;
import com.efast.cafe.portal.bean.statemach.PortalStateMachState;
import com.efast.cafe.portal.bean.statemach.PortalStateMachStateBean;
import com.efast.cafe.portal.bean.statemach.PortalStateMachStateConf;
import com.efast.cafe.portal.bean.statemach.PortalStateMachStateQueryBean;
import com.efast.cafe.portal.entity.company.PortalCompanyRole;

public interface PortalStateMachStateDao {

	/**
	 * 新增状态
	 * 
	 * @param state
	 */
	// @SaveOrUpdateOrDelControl
	void insertState(PortalStateMachState state);
	
	/**
	 * 新增状态配置
	 * 
	 * @param stateConf
	 */
	void insertStateConf(PortalStateMachStateConf stateConf);
	
	/**
	 * 替换状态配置
	 * 
	 * @param stateConf
	 */
	void replaceStateConf(PortalStateMachStateConf stateConf);
	
	void deleteStateConf(@Param(value = "companyCode") String companyCode,@Param(value = "confId")Integer confId,@Param(value = "stateId")Integer stateId);

	/**
	 * 编辑状态
	 * 
	 * @param state
	 */
	// @SaveOrUpdateOrDelControl
	void updateState(PortalStateMachState state);

	/**
	 * 删除状态
	 * 
	 * @param id
	 */
	// @SaveOrUpdateOrDelControl
	void deleteState(PortalStateMachState state);

	/**
	 * 获取企业可配置的状态
	 * 
	 * @param companyCode
	 * @return
	 */
	List<PortalStateMachState> queryCanConfigStateByCompanyCode(@Param(value = "companyCode") String companyCode);

	/**
	 * 获取状态列表(带分页)
	 * 
	 * @param queryBean
	 * @return
	 */
	// @PaginationControl(true)
	List<PortalStateMachState> queryStatePageList(PortalStateMachStateQueryBean queryBean);

	/**
	 * 获取状态列表数量
	 */
	Integer queryStatePageCount(PortalStateMachStateQueryBean queryBean);

	/**
	 * 根据配置ID获取状态
	 * 
	 * @param ConfId
	 * @return
	 */
	List<PortalStateMachStateBean> queryStateListByConfId(@Param(value = "confId") Long ConfId);

	/**
	 * 根据角色获取状态
	 * 
	 * @param roles
	 * @return
	 */
	List<StateMachByRoleBean> getPortalStateMachStateByRole(@Param(value = "roles") List<PortalCompanyRole> roles,
			@Param(value = "companyCode") String companyCode);

	/**
	 * 管理员获取状态
	 * 
	 * @param roles
	 * @return
	 */
	List<StateMachByRoleBean> getPortalStateMachStateByRoleForAdmin(@Param(value = "companyCode") String companyCode);

	List<PortalStateMachStateBean> getPortalStateMachStateByCompanyCode(String companyCode);
}
